package com.testdocs.client.signin;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.testdocs.client.signin.i18n.SignInConstants;

public class SignInViewImpl extends Composite implements SignInView {
	@UiTemplate("SignInView.ui.xml")
	interface SignInUiBinder extends
			UiBinder<Widget, SignInViewImpl> {
	}

	private static SignInUiBinder uiBinder = GWT
			.create(SignInUiBinder.class);

	@SuppressWarnings("unused")
	private SignInView.Presenter presenter;
	
	@UiField
	Label signInLabel;
	@UiField
	Anchor signInAnchor;
	
	SignInConstants signInConstants = (SignInConstants) GWT.create(SignInConstants.class);

	public SignInViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));
		
		signInLabel.setText(signInConstants.signInLabel());
		signInAnchor.setText(signInConstants.signIn());
	}

	@Override
	public void setSignInLink(String href) {
		signInAnchor.setHref(href);
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}
}
